﻿using System;

namespace DotNetImage.Imaging.Filters
{
    public class SepiaFilter : FilterBase
    {
        protected override void ProcessPixel(ref Pixel pix, uint x, uint y)
        {
            uint blue = pix.Blue;
            uint green = pix.Green;
            uint red = pix.Red;
            long r = (long)(0.393 * red + 0.769 * green + 0.189 * blue);
            long g = (long)(0.349 * red + 0.686 * green + 0.168 * blue);
            long b = (long)(0.272 * red + 0.534 * green + 0.131 * blue);

            pix.SetRGB(red, green, blue);
        }
    }
}
